home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1993 / MacHack 1993.toast / MacHack™ 1987-1992 / MacHack™ '90 / Other Stuff / Demos ƒ / Demo AppMaker / Demo AppMaker™ / Demo AppMaker™.rsrc / TmpC_106_ModalDialog < prev    next >
Encoding:
Text File  |  1990-03-23  |  1.7 KB  |  85 lines

  1. /* %filename% -- Modal dialog */
  2. /* Created %date% %time% by AppMaker */
  3.  
  4. %If lang = MPW%
  5. #include <Types.h>
  6. #include <Quickdraw.h>
  7. #include <Controls.h>
  8. #include <Dialogs.h>
  9. #include <Events.h>
  10. #include <Lists.h>
  11. #include <Menus.h>
  12. #include <TextEdit.h>
  13.  
  14. %end if%
  15. #include "ResourceDefs.h"
  16. #include "DialogAids.h"
  17.  
  18. #include "%unitname%.h"
  19.  
  20. #define nil            0L
  21.  
  22. %for each item gen itemNr%
  23. %If lang = MPW%
  24.  
  25. #pragma segment %unitname% 
  26. %end if%
  27.  
  28. %for each item gen auxiliary%
  29. %if needsFilter%
  30.     /*----------*/
  31.     pascal Boolean Filter%dlogname%    (DialogPtr        whichDialog,
  32.                                  EventRecord    *event,
  33.                                  short            *itemHit);
  34.     pascal Boolean Filter%dlogname% (whichDialog, event, itemHit)
  35.     DialogPtr        whichDialog;
  36.     EventRecord        *event;
  37.     short            *itemHit;
  38.     {
  39.     Boolean            filtered;
  40.     
  41.         filtered = false;
  42.         %for each item gen filter%
  43.         if (!filtered) {
  44.             filtered = StandardFilter (whichDialog, event, itemHit);
  45.         }
  46.         return (filtered);
  47.     } /*Filter%dlogname%*/
  48.     
  49. %end if%
  50. /*----------*/
  51. Boolean Get%dlogname% (%dlogname%)
  52. %dlogname%Rec%    %*%dlogname%;
  53. {
  54.     DialogPtr        theDialog;
  55.     Boolean            result;
  56.     Boolean            done;
  57.     short            itemNr;
  58.     register %dlogname%Ptr    info;
  59.  
  60.     InitCursor ();
  61.     theDialog = GetNewDialog (%dlogname%ID, nil, (WindowPtr) -1L);
  62.     SetPort (theDialog);
  63.     info = %dlogname%;
  64.     %for each item gen set%
  65.     
  66.     ShowWindow (theDialog);
  67.     OutlineButton (1);
  68.     done = false;
  69.     while (!done) {
  70.         %for each item gen enable%
  71. %if needsFilter%
  72.             ModalDialog (Filter%dlogname%, &itemNr);
  73. %else%
  74.             ModalDialog (nil, &itemNr);
  75. %end if%
  76.         switch (itemNr) {
  77.         %for each item gen hit%
  78.         } /* switch */
  79.     } /* while */
  80.     %for each item gen finish%
  81.     DisposDialog (theDialog);
  82.     return (result);
  83. } /*Get%dlogname%*/
  84.  
  85. /* %unitname% */